/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.lps.model;

import java.io.Serializable;

/**
 *
 * @author phichidev
 */
public class User implements Serializable {

    /**
     * identify a user
     */
    private int userid;
    private String username;
    private String password;
    private String fullname;
    private int department;

    public User() {
    }

    public User(int userid, String username, String password, String fullname, int department) {
        this.userid = userid;
        this.username = username;
        this.password = password;
        this.fullname = fullname;
        this.department = department;
    }

    public int getUserID() {
        return userid;
    }

    public void setUserID(int userid) {
        this.userid = userid;
    }

    public String getUserName() {
        return username;
    }

    public void setUserName(String username) {
        this.username = username;
    }

    public String getFullName() {
        return fullname;
    }

    public void setFullName(String fullname) {
        this.fullname = fullname;
    }

    public int getDepartment() {
        return department;
    }

    public void setDepartment(int department) {
        this.department = department;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        try {
            java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
            byte[] messageDigest = md.digest(password.getBytes());
            java.math.BigInteger number = new java.math.BigInteger(1, messageDigest);
            this.password = number.toString(16);
        } catch (java.security.NoSuchAlgorithmException ex) {
            ex.printStackTrace();
        }
    }

    /**
     *
     * @return
     */
    @Override
    public String toString() {
        return getFullName();
    }
}
